package waysing.cream.aspect;

import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;
import waysing.cream.vo.ReturnFormat;

/**
 * @author 作者 E-mail:weixinXie 274604559@qq.com
 * @version 创建时间：2018\3\15 0015 9:45
 * @describe 作者很懒，什么都没留下
 */
@ControllerAdvice
public class ControllerExceptionAdvice {
    @ExceptionHandler(IndexOutOfBoundsException.class)
    @ResponseBody
    public ReturnFormat handleIndexOutOfBoundsException(Exception e){
        return ReturnFormat.getReturnFormat(ReturnFormat.INDEX_OUT_OF_BOUNDS, ReturnFormat.messageMap.get(ReturnFormat.INDEX_OUT_OF_BOUNDS),null);
    }
}
